package hehe.log.base;


import com.sun.org.apache.bcel.internal.generic.RET;

import java.util.HashMap;
import java.util.Map;

/**
 * 消息
 *<B>说明：</B>
 *<pre>
 * 略 类详细描述
 *</pre>
 *<B>示例：</B>
 *<pre>
 *  略
 *</pre>
 *<B>日志：</B>
 *<pre>
 *  略
 *</pre>
 *<B>注意事项：</B>
 *<pre>
 *  略
 *</pre>
 */
public class Message
{
    /**
     * 创建事件
     *<B>说明：</B>
     *<pre>
     * 略
     *</pre>
     */
    protected long ctime = System.currentTimeMillis();

    protected Object msg;

    protected String level;

    protected Throwable t;

    protected Map<String,String> params = new HashMap<>();

    public Message(Object msg,String level)
    {
        this.msg = msg;
        this.level = level;
    }

    public Message(Object msg,String level,Throwable t)
    {
        this.msg = msg;
        this.level = level;
        this.t = t;

        this.params.put(Format.MESSAGE_ALIAS,msg.toString());
        this.params.put(Format.LEVEL_ALIAS,level);
        this.params.put(Format.DATETIME_ALIAS,String.valueOf(this.ctime));
    }

    public String getLevel()
    {
        return this.level;
    }

    public String getMsg()
    {
        return this.msg.toString();
    }

    public Map<String,String> getMessageParams()
    {
        return this.params;
    }

}
